package com.jhlishero.study.kafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;

import java.sql.SQLOutput;
import java.util.concurrent.CountDownLatch;

public class SimpleConsumerListener {
    private final static Logger logger = LoggerFactory.getLogger(SimpleConsumerListener.class);
    private final CountDownLatch latch1 = new CountDownLatch(1);

    @KafkaListener(id = "foo", topics = "topic-test")
    public void listen(ConsumerRecord record) {
        System.out.println("listen");
        System.out.println(record.key());
        System.out.println(record.value());
        this.latch1.countDown();
    }
}
